package spacecraft;

import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;

import markgame2d.engine.MarkScreen;


public class PauseScreen extends MarkScreen {
	
	SpaceCraft game;
	
	public PauseScreen() {
		this.game = SpaceCraft.getInstance();
	}
	
	public void keyPressed(KeyEvent e) {
		game.setScreen(game.gameScreen);
	}

	public void paint(Graphics2D g) {
		game.gameScreen.paint(g);
		g.setColor(new Color(0, 0, 0, 0.9f));
		g.fillRect(0, 0, SpaceCraft.WIDTH, SpaceCraft.HEIGHT);

		g.setColor(Color.WHITE);
		FontMetrics metrics = g.getFontMetrics();
		Rectangle rect = metrics.getStringBounds("Press any key to back to game", g).getBounds();
		g.drawString("Press any key to back to game",
				SpaceCraft.WIDTH/2 - rect.width/2,
				SpaceCraft.HEIGHT/2 - rect.height/2);
	}

}